
<!-- Code title -->
<p>
  <h1> <%=h @code.title  %></h1>
</p>

<!-- Code body -->
<p>
  <b>Code:</b> <br />
  <%=h @code.code_body %>
</p>

<!--
<p>
  <b>Tag:</b>
  <%=h @code.tag %>
</p>
-->

<!--
<p>
  <b>Description:</b>
  <%=h @code.description %>
</p>
-->

<!--
<p>
  <b>Shortdescription:</b>
  <%=h @code.shortdescription %>
</p>
-->

<!-- CODE INFO -->
<!-- user, cat, type and stuff, in one line. -->
<!-- TODO: make links instead of titles -->
<b>User:</b>
<%= link_to @code.getAuthorName, user_path(@code.getAuthorName) %>

<b>Program language:</b>
<%=h @code.getProgLangName %>

<b>Category:</b>
<%=h @code.getCategoryName %>

<b>Type:</b>
<%=h @code.getTypeName %>

<!-- COMMENT AREA -->
<!-- Separated with horizontal line at teh moment, TODO: use something nicer :) -->

<!-- post-comment layout -->
<hr />
	<!-- create layout for insertion of comment -->
	<% form_tag :action => 'create_comment' do %>
		
		<input type="hidden" name="code_id" value="<%= @code.id %>" />	
		<p>
    			<%= text_area :comment, :content %>
		</p>



		<p>
    			<%= submit_tag 'Comment' %>
  		</p>

		
	<% end %>

<hr />


<!-- comments display -->
<hr />
	<p>
		<p> 
			<b> Comments </b>
		</p>

			<% @comments.each do |comment| %>
			<table  class="comments_table">
  				<tr>
					<td style="width: 80%">
						
						<br />
						by
						<%= link_to comment.getAuthorName, user_path(comment.getAuthorName) %> 
						<br />

						<p><%=h comment.content %></p>
					</td>
  		
  				</tr>
			<% end %>
			</table>

	</p>
<hr />


<%= link_to 'Back', codes_path %>

